regarding Net::Telnet

regarding Net::Telnet

am 20.02.2007 09:04:36 von ukhas jean

--===============1856839837==
Content-Type: multipart/alternative; boundary="0-167320699-1171958676=:89354"
Content-Transfer-Encoding: 7bit

--0-167320699-1171958676=:89354
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi all ... had a problem executing this script which tries to run a "who"=
command on a unix host id01.
=20
use Net::Telnet;
=20
my $host =3D "id01";
my $port =3D "1800";
my $t =3D new Net::Telnet (Timeout =3D> 10);
$t->open(Host =3D> $host, Port =3D> $port);
$t->login("abc", "123");
my @lines =3D $t->cmd("^C");
my @lines =3D $t->cmd("who");
print "@lines";

Its giving me this error:-
unknown remote host: idl01 at test.pl line 5
=20
Any idea why this may be happening?? the host id01 can be reached if I =
do a manual "telnet id01" from start->run.
when i do a manual "telnet id01", there is a script that runs from .pro=
file file ... its by default ... i dont want to run that script ... hence=
the use of Ctrl-C or ^C.
=20
Any suggestions are most welcome.
=20
Thanks and Regards,
Ukh
=20
=20

=20
---------------------------------
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Gam=
es.
--0-167320699-1171958676=:89354
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi all ... had a problem executing this script which tries to run a =
"who" command on a unix host id01.
 
use Net=
::Telnet;
 
my $host =3D "id01";
my $port=
=3D "1800";
my $t =3D new Net::Telnet (Timeout =3D> 10);<=
BR>$t->open(Host =3D> $host, Port =3D> $port);
$t->login("=
abc", "123");
my @lines =3D $t->cmd("^C");
my @lines =3D=
$t->cmd("who");
print "@lines";
Its giving me this=
error:-
unknown remote host: idl01 at test.pl line 5
=
 
Any idea why this may be happening?? the host id0=
1 can be reached if I do a manual "telnet id01" from start->run.<=
/div>
when i do a manual "telnet id01", there is a script that runs=
from .profile file ... its by default ... i dont want to run that script=
... hence the use of Ctrl-C or ^C.
 
Any su=
ggestions are most welcome.
 
=20
Thanks and Regards,
Ukh
 
=
 




Be a PS3 game guru.
Get your game face on with "http://us.rd.yahoo.com/evt=3D49936/*http://videogames.yahoo .com">the lat=
est PS3 news and previews at Yahoo! Games.

--0-167320699-1171958676=:89354--

--===============1856839837==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1856839837==--

Re: regarding Net::Telnet

am 20.02.2007 10:10:36 von Bill Luebkert

ukhas jean wrote:
> Hi all ... had a problem executing this script which tries to run a
> "who" command on a unix host id01.
>
> use Net::Telnet;
>
> my $host = "id01";
> my $port = "1800";
> my $t = new Net::Telnet (Timeout => 10);
> $t->open(Host => $host, Port => $port);
> $t->login("abc", "123");
> my @lines = $t->cmd("^C");
> my @lines = $t->cmd("who");
> print "@lines";
> Its giving me this error:-
> unknown remote host: idl01 at test.pl line 5

Why is it saying 'idl01' instead of 'id01' ? Is $host correct ?
Is there something in the services file for id01 ?

> Any idea why this may be happening?? the host id01 can be reached if I
> do a manual "telnet id01" from start->run.
> when i do a manual "telnet id01", there is a script that runs from
> .profile file ... its by default ... i dont want to run that script ...
> hence the use of Ctrl-C or ^C.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re :regarding Net::Telnet

am 20.02.2007 10:33:41 von sandeep s kumar

--===============0167211187==
Content-Type: multipart/alternative;
boundary="=_61eae2ae1fc9bdcc27207919af273e5d"

--=_61eae2ae1fc9bdcc27207919af273e5d
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

 
Hi ,      why don\'t you try this code and see ......$t = new Net::Telnet (Timeout => 1000,
Prompt => );
$username=\"*****\";
$password=\"******\";
$t->open(\"id01\");
$t->login($username, $password);regards,sandeep s kumarukhas jean wroteHi all ... had a problem executing this script which tries to run a \"who\" command on a unix host id01.   use Net::Telnet;   my $host = \"id01\";my $port = \"1800\"; my $t = new Net::Telnet (Timeout => 10);$t->open(Host => $host, Port => $port);$t->login(\"abc\", \"123\");my @lines = $t->cmd(\"^C\"); my @lines = $t->cmd(\"who\");print \"@lines\"; Its giving me this error:- unknown remote host: idl01 at test.pl line 5   Any idea why this may be happening?? the host id01 can be reached if I do a manual \"telnet id01\" from start->run. when i do a manual \"telnet id01\", there is a script that runs from .profile file ... its by default ... i dont want to run that script ... hence the use of Ctrl-C or ^C.   Any suggestions are most welcome.   Thanks and Regards, Uk
h     Be a PS3 game guru.Get your game face on with the latest PS3 news and prev
iews at Yahoo! Games.
--=_61eae2ae1fc9bdcc27207919af273e5d
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

 

Hi ,

   &nb=
sp;  why don't you try this code and see ......


$t =
=3D new Net::Telnet (Timeout =3D> 1000,


Prompt =3D> );


$username=3D"*****";


$password=3D"******";


$t->open("id01");


$t->login($username, $password); font>


regards,
/>sandeep s kumar





ukhas je=
an wrote
Hi all ... had a problem executing this script which tries to=
run a "who" command on a unix host id01.   use Net::Telnet;   my=
$host =3D "id01";my $port =3D "1800"; my $t =3D new Net::Telnet (Timeout =
=3D> 10);$t->open(Host =3D> $host, Port =3D> $port);$t->logi=
n("abc", "123");my @lines =3D $t->cmd("^C"); my @lines =3D $t->cmd("w=
ho");print "@lines"; Its giving me this error:- unknown remote host: idl01 =
at test.pl line 5   Any idea why this may be happening?? the host id01=
can be reached if I do a manual "telnet id01" from start->run. whe=
n i do a manual "telnet id01", there is a script that runs from .profile fi=
le ... its by default ... i dont want to run that script ... hence the use =
of Ctrl-C or ^C.   Any suggestions are most welcome.  
Than=
ks and Regards, Ukh    

Be a PS3 game guru.
Get =
your game face on with the latest PS3 news and previews at Yahoo! Games. />
w.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3 D3"> "http://adworks.rediff.com/cgi-bin/AdWorks/sigimpress.cgi/ww w.rediff.com/si=
gnature-home.htm/1963059423@Middle5?OAS_query=3Dnull&PARTNER =3D3" BORDER=3D=
0 VSPACE=3D0 HSPACE=3D0>

--=_61eae2ae1fc9bdcc27207919af273e5d--

--===============0167211187==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0167211187==--

Re: regarding Net::Telnet

am 20.02.2007 10:47:21 von ukhas jean

--===============1626610380==
Content-Type: multipart/alternative; boundary="0-1893904972-1171964841=:71764"
Content-Transfer-Encoding: 7bit

--0-1893904972-1171964841=:71764
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

no ... its id01 and not idl01 ... sorry made a typo!!!

Bill Luebkert wrote: ukhas jean wrote:
> Hi all ... had a problem executing this script which tries to run a=20
> "who" command on a unix host id01.
>=20
> use Net::Telnet;
>=20
> my $host =3D "id01";
> my $port =3D "1800";
> my $t =3D new Net::Telnet (Timeout =3D> 10);
> $t->open(Host =3D> $host, Port =3D> $port);
> $t->login("abc", "123");
> my @lines =3D $t->cmd("^C");
> my @lines =3D $t->cmd("who");
> print "@lines";
> Its giving me this error:-
> unknown remote host: idl01 at test.pl line 5

Why is it saying 'idl01' instead of 'id01' ? Is $host correct ?
Is there something in the services file for id01 ?

> Any idea why this may be happening?? the host id01 can be reached if I=20
> do a manual "telnet id01" from start->run.
> when i do a manual "telnet id01", there is a script that runs from=20
> .profile file ... its by default ... i dont want to run that script ...=
=20
> hence the use of Ctrl-C or ^C.


=20
---------------------------------
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
--0-1893904972-1171964841=:71764
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

no ... its id01 and not idl01 ... sorry made a typo!!!

Bill =
Luebkert <dbecoll@roadrunner.com>
wrote:

=3Dreplbq style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #101=
0ff 2px solid">ukhas jean wrote:
> Hi all ... had a problem executi=
ng this script which tries to run a
> "who" command on a unix host=
id01.
>
> use Net::Telnet;
>
> my $host =3D "i=
d01";
> my $port =3D "1800";
> my $t =3D new Net::Telnet (Tim=
eout =3D> 10);
> $t->open(Host =3D> $host, Port =3D> $p=
ort);
> $t->login("abc", "123");
> my @lines =3D $t->cm=
d("^C");
> my @lines =3D $t->cmd("who");
> print "@lines";=

> Its giving me this error:-
> unknown remote host: idl01 at=
test.pl line 5

Why is it saying 'idl01' instead of 'id01' ? Is $h=
ost correct ?
Is there something in the services file for id01 ?
R>> Any idea why this may be happening?? the host id01
can be reached if I
> do a manual "telnet id01" from start->ru=
n.
> when i do a manual "telnet id01", there is a script that runs =
from
> .profile file ... its by default ... i dont want to run tha=
t script ...
> hence the use of Ctrl-C or ^C.

=




Need Mail bonding?
Go to the hoo.com/dir/index;_ylc=3DX3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOAR fcwMzOTY1NDUx=
MDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=3Dask&sid= 3D396546091">=
Yahoo! Mail Q&A
for c=3DX3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2Vj A21haWxfdGFnb=
GluZQRzbGsDbWFpbF90YWcx?link=3Dask&sid=3D396546091">great tips from Yahoo=
! Answers
users.
--0-1893904972-1171964841=:71764--

--===============1626610380==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1626610380==--

RE: regarding Net::Telnet

am 20.02.2007 11:40:27 von Brian Raven

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of ukhas
jean
Sent: 20 February 2007 08:05
To: Active Perl
Subject: regarding Net::Telnet

> Hi all ... had a problem executing this script which tries to run a
"who" command on a unix host id01.
> =


'use strict; use warnings;' missing. Always include them at the start of
scripts. Had you included them, you would have seen a warning about a
potential problem with your code.

> use Net::Telnet;
> =

> my $host =3D "id01";
> my $port =3D "1800";

Are you sure about that? Just checking, as that isn't the normal telnet
port.

> my $t =3D new Net::Telnet (Timeout =3D> 10);
> $t->open(Host =3D> $host, Port =3D> $port);
> $t->login("abc", "123");
> my @lines =3D $t->cmd("^C");
> my @lines =3D $t->cmd("who");
> print "@lines";
> =

> Its giving me this error:-
> unknown remote host: idl01 at test.pl line 5
> =

> Any idea why this may be happening?? the host id01 can be reached if I
do a manual "telnet id01" from start->
> run.

Hard to say. I notice from the source code that it uses inet_atoi to
look up the ip address of the host. Try using the ip address explicitly
instead of the host name. Also try adding the host to your hosts file
(its location is platform dependant).

> when i do a manual "telnet id01", there is a script that runs from
..profile file ... its by default ... i dont > want to run that script
.... hence the use of Ctrl-C or ^C.

Well, that is unlikely to do what you want. First, the login function
waits for a prompt before returning, so your attempt to send Ctrl-C is
too late. Second your attempt to send Ctrl-C actually sends "^" followed
by "C" followed by "\n", which isn't the same thing. Possibly something
like '$p->put("\003"); $p->cmd();' might work.

> =

> Any suggestions are most welcome.

It's always a good idea to read the documentation of the modules and
functions that you use, especially if you are having problems with them.
I have never used the module, the above comments are the result of a
brief glance at the documentation.

HTH

-- =

Brian Raven =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: regarding Net::Telnet

am 20.02.2007 13:40:57 von Bill Luebkert

ukhas jean wrote:
> no ... its id01 and not idl01 ... sorry made a typo!!!

The suggestion to try the IP address is also a good idea.

I ran your script to localhost with a telnet daemon running on XP
and it worked fine (I used a different command than who and commented
out the improper Ctrl-C), but basically the same script. It appears
to be failing for you on the open line (even though it's at least
line 6 in your example). Using the IP may help if the error message
is correct.

> */Bill Luebkert /* wrote:
>
> ukhas jean wrote:
> > Hi all ... had a problem executing this script which tries to run a
> > "who" command on a unix host id01.
> >
> > use Net::Telnet;
> >
> > my $host = "id01";
> > my $port = "1800";
> > my $t = new Net::Telnet (Timeout => 10);
> > $t->open(Host => $host, Port => $port);
> > $t->login("abc", "123");
> > my @lines = $t->cmd("^C");
> > my @lines = $t->cmd("who");
> > print "@lines";
> > Its giving me this error:-
> > unknown remote host: idl01 at test.pl line 5
>
> Why is it saying 'idl01' instead of 'id01' ? Is $host correct ?
> Is there something in the services file for id01 ?

I meant hosts file rather than services above.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: regarding Net::Telnet

am 21.02.2007 11:47:05 von Angelos Karageorgiou

If you cannot ping id01 from the command line then you have resolver
troubles


ukhas jean wrote:
> Hi all ... had a problem executing this script which tries to run a
> "who" command on a unix host id01.
>
> use Net::Telnet;
>
> my $host = "id01";

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: regarding Net::Telnet

am 23.02.2007 05:43:32 von ukhas jean

--===============0499939425==
Content-Type: multipart/alternative; boundary="0-1844599444-1172205812=:82021"
Content-Transfer-Encoding: 7bit

--0-1844599444-1172205812=:82021
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Bill et al ...=20
=20
I have connected successfully to my remote linux machine using Net::Tel=
net and am able to execute commands like pwd, ls, who, etc. ... but ... t=
here is one command that is troubling me ... the "cd" command ...=20
Sorry to say, but, I cant see it mentioned in documentation how to do a=
successful directory change using a "telnet-object" ...=20
i tried this:-
=20
$t->cmd('cd\ \/view');
where $t is the object name ... and cd /view is the directory i want to=
goto using $t.
=20
when i use the above line the script simply hangs and goes into a time-=
out. when i comment this line the rest of the code works fine; so i guess=
this is where i am going wrong.
=20
Any pointers in the right direction plz??=20
=20
Best Regards,
Ukh

Bill Luebkert wrote:
ukhas jean wrote:
> no ... its id01 and not idl01 ... sorry made a typo!!!

The suggestion to try the IP address is also a good idea.

I ran your script to localhost with a telnet daemon running on XP
and it worked fine (I used a different command than who and commented
out the improper Ctrl-C), but basically the same script. It appears
to be failing for you on the open line (even though it's at least
line 6 in your example). Using the IP may help if the error message
is correct.

> */Bill Luebkert /* wrote:
>=20
> ukhas jean wrote:
> > Hi all ... had a problem executing this script which tries to run a
> > "who" command on a unix host id01.
> >
> > use Net::Telnet;
> >
> > my $host =3D "id01";
> > my $port =3D "1800";
> > my $t =3D new Net::Telnet (Timeout =3D> 10);
> > $t->open(Host =3D> $host, Port =3D> $port);
> > $t->login("abc", "123");
> > my @lines =3D $t->cmd("^C");
> > my @lines =3D $t->cmd("who");
> > print "@lines";
> > Its giving me this error:-
> > unknown remote host: idl01 at test.pl line 5
>=20
> Why is it saying 'idl01' instead of 'id01' ? Is $host correct ?
> Is there something in the services file for id01 ?

I meant hosts file rather than services above.


=20
---------------------------------
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
--0-1844599444-1172205812=:82021
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Bill et al ...
 
I have connected s=
uccessfully to my remote linux machine using Net::Telnet and am=
able to execute commands like pwd, ls, who, etc. ... but ... there is on=
e command that is troubling me ... the "cd" command ...
Sorr=
y to say, but, I cant see it mentioned in documentation how to do a succe=
ssful directory change using a "telnet-object" ...
i tried t=
his:-
 
$t->cmd('cd\ \/view');
v>where $t is the object name ... and cd /view is the directory i want to=
goto using $t.
 
when i use the above line =
the script simply hangs and goes into a time-out. when i comment this lin=
e the rest of the code works fine; so i guess this is where i am going wr=
ong.
 
Any pointers in the right direction p=
lz??
 
Best Regards,
Ukh
>Bill Luebkert
<dbecoll@roadrunner.com>
wrote:
replbq style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff=
2px solid">ukhas jean wrote:
> no ... its id01 and not idl01 ... s=
orry made a typo!!!

The suggestion to try the IP address is also a=
good idea.

I ran your script to localhost with a telnet daemon ru=
nning on XP
and it worked fine (I used a different command than who an=
d commented
out the improper Ctrl-C), but basically the same script. I=
t appears
to be failing for you on the open line (even though it's at =
least
line 6 in your example). Using the IP may help if the error mess=
age
is correct.

> */Bill Luebkert /*=
wrote:
>
> ukhas jean wrote:
> > Hi all ... had a =
problem executing this script which tries to run a
> > "who" com=
mand on a unix host id01.
> >
> > use Net::Telnet;
&=
gt; >
> > my $host =3D
"id01";
> > my $port =3D "1800";
> > my $t =3D new Net=
::Telnet (Timeout =3D> 10);
> > $t->open(Host =3D> $hos=
t, Port =3D> $port);
> > $t->login("abc", "123");
> =
> my @lines =3D $t->cmd("^C");
> > my @lines =3D $t->cm=
d("who");
> > print "@lines";
> > Its giving me this er=
ror:-
> > unknown remote host: idl01 at test.pl line 5
> <=
BR>> Why is it saying 'idl01' instead of 'id01' ? Is $host correct ? R>> Is there something in the services file for id01 ?

I meant =
hosts file rather than services above.




It's here! Your new message!
Get
com/toolbar/features/mail/"> new email alerts with the free "
http://us.rd.yahoo.com/evt=3D49938/*http://tools.search.yaho o.com/toolbar=
/features/mail/">Yahoo! Toolbar.

--0-1844599444-1172205812=:82021--

--===============0499939425==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0499939425==--

Re: regarding Net::Telnet

am 23.02.2007 11:04:15 von Bill Luebkert

ukhas jean wrote:
> Hi Bill et al ...
>
> I have connected successfully to my remote linux machine using
> Net::Telnet and am able to execute commands like pwd, ls, who, etc. ...
> but ... there is one command that is troubling me ... the "cd" command ...
> Sorry to say, but, I cant see it mentioned in documentation how to do a
> successful directory change using a "telnet-object" ...
> i tried this:-
>
> $t->cmd('cd\ \/view');
> where $t is the object name ... and cd /view is the directory i want to
> goto using $t.

Why are you escaping a space and '/' ? 'cd /view' would seem to be fine
instead.

> when i use the above line the script simply hangs and goes into a
> time-out. when i comment this line the rest of the code works fine; so i
> guess this is where i am going wrong.
>
> Any pointers in the right direction plz??

Musing a bit:

I assume the commands are being run through a shell on the remote host.
What shell are the commands being run under remotely ? Maybe try
'chdir /view' as an alternate if the fix above for cd doesn't work.

Could the telnet dameon be grabbing the cd command rather than passing
it to the shell ?

You would think that one command would be the same as any other as
long as it is in the path or built into the shell.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: regarding Net::Telnet

am 23.02.2007 11:07:52 von Brian Raven

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of ukhas
jean
Sent: 23 February 2007 04:44
To: Active Perl
Subject: Re: regarding Net::Telnet

> Hi Bill et al ... =

> =

> I have connected successfully to my remote linux machine using
Net::Telnet and am able to execute commands like > pwd, ls, who, etc.
.... but ... there is one command that is troubling me ... the "cd"
command ... =

> Sorry to say, but, I cant see it mentioned in documentation how to do
a successful directory change using a =

> "telnet-object" ... =

> i tried this:-
> =

> $t->cmd('cd\ \/view');
> where $t is the object name ... and cd /view is the directory i want
to goto using $t.
> =

> when i use the above line the script simply hangs and goes into a
time-out. when i comment this line the rest =

> of the code works fine; so i guess this is where i am going wrong.
> =


First, whats with all the backslashes? it may not be the cause of your
problem, but it certainly will not do what you want.

Second, what happens when you try that using telnet from the command
line?

HTH

-- =

Brian Raven =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: regarding Net::Telnet

am 23.02.2007 11:58:42 von ukhas jean

--===============2089735018==
Content-Type: multipart/alternative; boundary="0-1385242575-1172228322=:34529"
Content-Transfer-Encoding: 7bit

--0-1385242575-1172228322=:34529
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Bill,
=20
the default shell when i login to the linux machine is the korn shell.
I have tried without the escaping of '/' and ' ' (space) ... it still d=
oesnt work ... ofcourse i tried 'chdir /view' but it reports an error. (s=
ince chdir is not a shell-command).
=20
I am stuck at this place for more than 5 hours and google aint helping =
me either. :(
=20
ANy help is most appreciable.
=20
Ukh.

Bill Luebkert wrote:
ukhas jean wrote:
> Hi Bill et al ...
>=20
> I have connected successfully to my remote linux machine using=20
> Net::Telnet and am able to execute commands like pwd, ls, who, etc. ...=
=20
> but ... there is one command that is troubling me ... the "cd" command =
....
> Sorry to say, but, I cant see it mentioned in documentation how to do a=
=20
> successful directory change using a "telnet-object" ...
> i tried this:-
>=20
> $t->cmd('cd\ \/view');
> where $t is the object name ... and cd /view is the directory i want to=
=20
> goto using $t.

Why are you escaping a space and '/' ? 'cd /view' would seem to be fine
instead.

> when i use the above line the script simply hangs and goes into a=20
> time-out. when i comment this line the rest of the code works fine; so =
i=20
> guess this is where i am going wrong.
>=20
> Any pointers in the right direction plz??

Musing a bit:

I assume the commands are being run through a shell on the remote host.
What shell are the commands being run under remotely ? Maybe try
'chdir /view' as an alternate if the fix above for cd doesn't work.

Could the telnet dameon be grabbing the cd command rather than passing
it to the shell ?

You would think that one command would be the same as any other as
long as it is in the path or built into the shell.




=20
---------------------------------
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
--0-1385242575-1172228322=:34529
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Bill,
 
the default shell when i log=
in to the linux machine is the korn shell.
I have t=
ried without the escaping of '/' and ' ' (space) ... it still doesnt work=
... ofcourse i tried 'chdir /view' but it reports an error. (since chdir=
is not a shell-command).
 
I am stuck at th=
is place for more than 5 hours and google aint helping me either. :( >
 
ANy help is most appreciable.
&nbs=
p;
Ukh.

Bill Luebkert <dbecoll@roadrunner.com=
>
wrote:
FT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">ukhas jean wro=
te:
> Hi Bill et al ...
>
> I have connected successfu=
lly to my remote linux machine using
> Net::Telnet and am able to =
execute commands like pwd, ls, who, etc. ...
> but ... there is on=
e command that is troubling me ... the "cd"
command ...
> Sorry to say, but, I cant see it mentioned in docume=
ntation how to do a
> successful directory change using a "telnet-=
object" ...
> i tried this:-
>
> $t->cmd('cd\ \/vie=
w');
> where $t is the object name ... and cd /view is the director=
y i want to
> goto using $t.

Why are you escaping a space a=
nd '/' ? 'cd /view' would seem to be fine
instead.

> when i =
use the above line the script simply hangs and goes into a
> time-=
out. when i comment this line the rest of the code works fine; so i
&=
gt; guess this is where i am going wrong.
>
> Any pointers i=
n the right direction plz??

Musing a bit:

I assume the comm=
ands are being run through a shell on the remote host.
What shell are =
the commands being run under remotely ? Maybe try
'chdir /view' as an =
alternate if the fix above for cd doesn't work.

Could the telnet d=
ameon be grabbing the cd command rather
than passing
it to the shell ?

You would think that one comman=
d would be the same as any other as
long as it is in the path or built=
into the shell.






Need Mail bonding?
Go to the hoo.com/dir/index;_ylc=3DX3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOAR fcwMzOTY1NDUx=
MDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=3Dask&sid= 3D396546091">=
Yahoo! Mail Q&A
for c=3DX3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2Vj A21haWxfdGFnb=
GluZQRzbGsDbWFpbF90YWcx?link=3Dask&sid=3D396546091">great tips from Yahoo=
! Answers
users.
--0-1385242575-1172228322=:34529--

--===============2089735018==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============2089735018==--

Re: regarding Net::Telnet

am 23.02.2007 14:42:32 von Bill Luebkert

ukhas jean wrote:
> Hi Bill,
>
> the default shell when i login to the linux machine is the korn shell.
> I have tried without the escaping of '/' and ' ' (space) ... it still
> doesnt work ... ofcourse i tried 'chdir /view' but it reports an error.
> (since chdir is not a shell-command).

I use tcsh and it has chdir built in.

> I am stuck at this place for more than 5 hours and google aint helping
> me either. :(
>
> ANy help is most appreciable.

1) You could try running another shell like bash or tcsh using a ->cmd()
and see if that makes any difference.

2) You could always write your own cd/chdir in Perl and upload it and
use that.

Something like this should work:

#!/usr/bin/perl

use strict;
use warnings;
use Cwd;

my $dir = getcwd;
my $newdir = shift || '';
if ($newdir) {
chdir $newdir or die "$!($^E)";
} else {
chdir or die "$!($^E)";
}
# print "$dir => $newdir\n";

__END__

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs